package com.gluck.cases.core.modal.assemble;


import com.gluck.cases.core.modal.dto.AdminRoleDTO;
import com.gluck.cases.core.modal.entity.AdminRole;
import com.gluck.cases.core.modal.req.AdminRoleReq;

import java.util.Date;

/**
 * @ClassName AdminRoleAssemble
 * @Desc AdminRole 组装类
 * @Author I am Gluck
 * @Date 2022/5/21 - 10:25 下午
 **/
public class AdminRoleAssemble {

    public static AdminRole AdminRoleDTOConvertAdminRole(AdminRoleDTO dto){
        AdminRole adminRole = new AdminRole();
        adminRole.setId(dto.getId());
        adminRole.setRoleId(dto.getRoleId());
        adminRole.setRemark(dto.getRemark());
        adminRole.setUserId(dto.getUserId());
        adminRole.setSort(dto.getSort());
        return adminRole;
    }

    public static AdminRoleDTO AdminRoleReqConvertAdminRoleDTO(AdminRoleReq req){
        AdminRoleDTO dto = new AdminRoleDTO();
        dto.setRoleId(req.getRoleId());
        dto.setRemark(req.getRemark());
        dto.setCreatedBy(dto.getCreatedBy());
        dto.setSort(req.getSort());
        dto.setUserId(dto.getUserId());
        dto.setUpdatedAt(new Date());
        return dto;
    }

}
